<template>
  <div class="flow-node flow-arrows-2 margin-top">
    <el-dropdown class="flow-add-btn" slot="suffix" trigger="click" @command="handleAdd">
      <span class="el-dropdown-link">
        <i class="el-input__icon el-icon-circle-plus-outline relative-select"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <template v-if="showCondition">
          <el-dropdown-item command="node">添加节点</el-dropdown-item>
          <el-dropdown-item command="condition">添加条件分支</el-dropdown-item>
        </template>
        <el-dropdown-item v-else command="node2">添加节点</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
export default {
  name: "AddBtn",
  props: {
    showCondition: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    handleAdd(command) {
      this.$emit("command", command);
    }
  }
}
</script>

<style scoped>

</style>
